home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Add-Ons / Avara / Custom Scorer / source / AvaraScoreInterface.h next >
Encoding:
C/C++ Source or Header  |  1996-12-31  |  5.4 KB  |  147 lines  |  [TEXT/CWIE]

  1. /*/
  2. /*/
  3.  
  4. #pragma once
  5.  
  6. #define    kScoreInterfaceFileType        'AVSI'
  7. #define    kScoreInterfaceCodeType        'SCIF'
  8. #define    kScoreInterfaceCodeID        128
  9.  
  10. typedef    enum
  11. {
  12.         ksiInit,            //    Called when the plug-in is loaded.
  13.         ksiClose,            //    Called before application quits or plug-in changes
  14.  
  15.         ksiScore,            //    Some entity (player/computer) scored points in the game.
  16.         ksiPlayerIntro,        //    After start/resume, each player in the game is "introduced"
  17.  
  18.         ksiLevelLoaded,        //    A new level was loaded.
  19.         ksiLevelStarted,    //    A level was started (frame 0)
  20.         ksiLevelPaused,        //    The game was paused
  21.         ksiLevelRestarted,    //    The game was resumed after a pause
  22.         ksiLevelEnded,        //    The game ends (for whatever reason)
  23.  
  24.         ksiResultsUpdate,    //    The window needs an update...revise results text handle, if necessary
  25.         ksiResultsDraw,        //    Update-related draw. Only use this, if you do your own drawing
  26.         ksiResultsShow,        //    Custom results page is now visible...add controls & whatever
  27.         ksiResultsHide,        //    Custom results page needs to be hidden...hide/remove your controls.
  28.         ksiResultsClick,    //    A mouse click was detected in the custom results page
  29.         
  30.         ksiSave,            //    User chose Save from a menu (not supported yet)
  31.         ksiCopy,            //    User chose Copy from a menu (not supported yet)
  32.         ksiPrint,            //    User chose Print from a menu (not supported yet)
  33.         
  34.         ksiConsoleText        //    Called for console text messages...gives you a chance to "filter" them.
  35.         
  36. }    ScoreInterfaceMessages;
  37.  
  38. //    Reasons why ksiScore call was made:
  39. typedef    enum
  40. {
  41.         ksiShotHit,
  42.         ksiGrenadeHit,
  43.         ksiMissileHit,
  44.         ksiMineBlast,
  45.         ksiSelfDestructBlast,
  46.         ksiObjectCollision,        //    Running into a moving door for instance (not supported yet)
  47.         ksiSecondaryDamage,
  48.         
  49.         ksiKillBonus,
  50.         ksiExitBonus,
  51.         ksiGoodyBonus,
  52.         
  53.         ksiHoldBall,
  54.         ksiScoreGoal
  55.  
  56. }    ScoreInterfaceReasons;
  57.  
  58. //    The following will be used for enabling menus. Set the capabilities bits accordingly.
  59. typedef    enum
  60. {
  61.         ksiCanSave = 1,        //    Receive "Save" commands
  62.         ksiCanCopy = 2,        //    Can copy to clipboard
  63.         ksiCanPrint = 4        //    Can print (currently unsupported).
  64.  
  65. }    ScoreInterfaceCapabilities;
  66.  
  67. typedef struct
  68. {
  69.     long            command;        //    One of ScoreInterfaceMessages
  70.     long            result;            //    Reserved for future calls that may return results.
  71.     long            capabilities;    //    Your capabilities.
  72.     Handle            plugIn;            //    Your plug-in code handle
  73.     
  74.     long            maxPlayers;        //    ksiInit sets this. (current default is 6)
  75.     long            maxTeams;        //    ksiInit sets this. (current default is 6) Doesn't include neutral team!!
  76.     
  77.     long            frameTime;        //    Time for each frame in milliseconds.
  78.     long            frameNumber;    //    Number of current frame (starts at 0)
  79.     
  80.     /*
  81.     **    The results are stored in a text handle called resultsHandle.
  82.     **    It should always be a valid handle, but can be changed to point
  83.     **    to a new handle, if necessary. If you do change it to a new Handle,
  84.     **     you are responsible for disposing the old contents.
  85.     **
  86.     **    When you change the contents of the handle (which can be at any
  87.     **    time), please set resultsChanged to true. This will be detected
  88.     **    by Avara and the area in the Mission window will be invalidated.
  89.     **    If you change it in a ksiResultsUpdate call, the results will not
  90.     **    be drawn immediately (a new update event will be generated) and
  91.     **    you will receive another ksiResultsUpdate call. This can repeat
  92.     **    forever unless you are carelessly setting the resultsChanged flag
  93.     **    even when the text has not changed.
  94.     */
  95.     Handle            resultsHandle;
  96.     long            resultsChanged;
  97.     
  98.     /*
  99.     **    Alternatively, you can draw the results yourself when you receive a
  100.     **    ksiResultsDraw call. If you add any controls to the window, you have
  101.     **    to remove them when you are closed and you have to hide them when you
  102.     **    receive a ksiResultsHide call.
  103.     */
  104.     WindowPtr        resultsWindow;    //    Guaranteed to be valid only for hide/draw/click
  105.     Rect            resultsRect;    //    Valid only for draw/click calls
  106.     EventRecord        *theEvent;
  107.     
  108.     /*
  109.     **    The following parameters are valid for all calls and usually change
  110.     **    only at ksiLevelLoaded calls.
  111.     */
  112.     StringPtr        levelName;        //    Always pointer to current level name.
  113.     StringPtr        levelCreator;
  114.     StringPtr        levelDescription;
  115.     OSType            directoryTag;    //    4-letter mission collection identifier
  116.     OSType            levelTag;        //    4-letter mission identifier (within collection)
  117.  
  118.     /*
  119.     **    The following are valid only for ksiPlayerIntro, ksiPlayerNameChange
  120.     **    ksiScore and ksiKilled calls. You can ignore ksiPlayerNameChange calls,
  121.     **    if you want to use the names the the players had at the start of a level.
  122.     */
  123.     long            playerID;        //    From 0 to 6 (0 is computer team, 1-6 are player teams. Unless Avara is changed!)
  124.     long            playerTeam;        //    From -1 to 5 (0 to 5 are players. Unless Avara is changed!)
  125.     long            playerLives;    //    Not valid when playerID == -1 (computer)
  126.     StringPtr        playerName;        //    Player name, when appropriate
  127.     long            winFrame;        //    Frame at which player exited (won) or -1.
  128.     
  129.     /*
  130.     **    The following are only valid for ksiScore calls:
  131.     */
  132.     long            scorePoints;    //    How many points are awarded.
  133.     Fixed            scoreEnergy;    //    Only when this makes sense. (Energy blast caused damage)
  134.     long            scoreReason;    //    What happened, why were the points given...see enum.
  135.     long            scoreTeam;        //    Which team was hit?
  136.     long            scoreID;        //    Who was hit? (-1 for computers)
  137.  
  138.     /*
  139.     **    Console text:
  140.     */    
  141.     StringPtr        consoleLine;    //    Text content of console line
  142.     long            consoleJustify;    //    Which way to justify text -1, 0, 1 (right, center, left)
  143.     
  144. }    ScoreInterfaceRecord;
  145.  
  146. typedef pascal void        ScoreInterfaceCallType(ScoreInterfaceRecord *rec);
  147.